<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>07_class</title>
</head>

<body>
    <script>
        //ES5 class
        function Phone(brand, price) {
            this.brand = brand
            this.price = price
        }

        Phone.prototype.call = function () {
            console.log('我可以打电话')
        }

        var huawei = new Phone('华为', 3999)
        console.log(huawei)
        huawei.call()

        //ES6 class
        class Shouji {
            constructor(brand, price) {
                this.brand = brand
                this.price = price
            }
            call() {
                console.log('我可以打电话')
            }
        }

        let onePlus = new Shouji('一加', 1999)
        console.log(onePlus)
        onePlus.call()
    </script>
</body>

</html>